/**
 * 
 */
package com.cloudcast.client.view;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;

/**
 * @author Samuel García Martínez <in0de>
 *
 */
public class DashboardView implements View {

	private ContentPanel menuPanel;
	private ContentPanel mainPanel;
	
	public DashboardView() {
		this.mainPanel = buildMainPanel();
		this.menuPanel = buildMenuPanel();
	}
	
	/* 
	 * (non-Javadoc)
	 * @see com.cloudcast.client.view.View#asContainer()
	 */
	@Override
	public LayoutContainer asContainer() {
		LayoutContainer container = new LayoutContainer();
		
		container.setLayout(new BorderLayout());
		container.setId("DASHBOARDVIEW");
		
		container.add(menuPanel, new BorderLayoutData(LayoutRegion.WEST, 300));
		container.add(mainPanel, new BorderLayoutData(LayoutRegion.CENTER, 300));
//		container.add(menuPanel);
//		container.add(mainPanel);
		
		container.setHeight(300);
		
		return container;
	}

	private ContentPanel buildMenuPanel() {
		ContentPanel menuPanel = new ContentPanel();
		
		menuPanel.setTitle("Menu");		
		menuPanel.setHeading("Menu Panel Container");
		menuPanel.setId("MENUPANELCONTAINER");
		menuPanel.setBorders(false);
		
		return menuPanel;
	}
	
	private ContentPanel buildMainPanel() {
		ContentPanel mainPanel = new ContentPanel();
		
		mainPanel.setTitle("Main Panel");
		mainPanel.setHeading("Main Panel Container");
		mainPanel.setId("MAINPANELCONTAINER");
		mainPanel.setBorders(false);
		
		return mainPanel;
	}
	
	public ContentPanel getMenuPanel() {
		return menuPanel;
	}
	public ContentPanel getMainPanel() {
		return mainPanel;
	}
}
